package com.entity;

import java.io.Serializable;

/**
 * @Author ri.yang
 * @Since 2016/1/6.
 */
public class Classroom implements Serializable {
    /**
     * 教室最大容量为50人
     */
    public static final int MAX_CAPACITY = 50;
    private Integer id;
    //教室容量
    private Integer capacity;
    //教室编号
    private String classroomNo;
    //教室地点
    private String place;

    public Classroom() {

    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getCapacity() {
        return capacity;
    }

    /**
     * 设置教室容量
     *
     * @param capacity
     */
    public void setCapacity(Integer capacity) {
        if (capacity > Classroom.MAX_CAPACITY) {
            throw new RuntimeException("exceed max capacity");
        }
        if (capacity <= 0) {
            throw new RuntimeException("invalid capacity");
        }
        this.capacity = capacity;
    }

    public String getClassroomNo() {
        return classroomNo;
    }

    public void setClassroomNo(String classroomNo) {
        this.classroomNo = classroomNo;
    }

    public String getPlace() {
        return place;
    }

    public void setPlace(String place) {
        this.place = place;
    }

    @Override
    public String toString() {
        return "Classroom{" +
                "id=" + id +
                ", capacity=" + capacity +
                ", classroomNo='" + classroomNo + '\'' +
                ", place='" + place + '\'' +
                '}';
    }
}
